<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">

				<el-form-item label="直播间ID">
				    <el-input
				            class="w-[150px]"
				            v-model="queryParams.room_id"
				            placeholder="请输入直播间ID"
				            clearable
				            @keyup.enter="resetPage"
				    />
				</el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none mt-4" shadow="never">
            <el-tabs class="demo-tabs">
                <el-table size="large" v-loading="pager.loading" :data="pager.lists" style="width: 100%">
                    <el-table-column label="直播房间号" prop="room_id" min-width="150" />

                    <el-table-column label="点名唯一标识" prop="sign_check"  min-width="150" />
                    <el-table-column label="签到人数" prop="sign_total"  min-width="100" />
                    <el-table-column label="持续时间" prop="minute"  min-width="100" />

                    <el-table-column label="第几次点名" prop="layer"  min-width="120" />
					<el-table-column label="奖励类型" prop="reward_type_name"  min-width="100" />
					<el-table-column label="赠送的优惠券" prop="coupon_name"  min-width="120" />
                    <el-table-column label="发起时间" prop="add_time"  min-width="190" />
                   <!-- <el-table-column label="备注" prop="name"  min-width="150">
                         <template #default="{ row }">
                            {{ row.created_at }}
                        </template>
                    </el-table-column> -->
                    <el-table-column label="操作面板" min-width="160" fixed="right">
                        <template #default="{ row }">
							<el-button @click="handleDetail(row)" type="primary" class="w-[84px] h-[30px] mb-[9px] text-[12px]"  >查看点名记录</el-button >
                        </template>
                    </el-table-column>
                </el-table>
                <div class="flex justify-end mt-4">
                    <pagination v-model="pager" @change="getLists" />
                </div>
            </el-tabs>
        </el-card>
		<detailPopup v-if="showDetail" ref="detailRef" @success="getLists" @close="showDetail = false" />
    </div>
</template>
<script lang="ts" setup>
    import { reissue, clockList } from '@/api/consumer'
    import { usePaging } from '@/hooks/usePaging'
    import feedback from "@/utils/feedback";
    import router, { getRoutePath } from '@/router'
    import detailPopup from './detail.vue'
    const queryParams = reactive({
		room_id:'',
    });

    const { pager, getLists, resetPage, resetParams } = usePaging({
        fetchFun: clockList,
        params: queryParams
    });

	const detailRef = shallowRef<InstanceType<typeof detailPopup>>()
	const showDetail = ref(false)
	const handleDetail = async (data:any[]) => {
	    showDetail.value = true
	    await nextTick()
	    detailRef.value?.open(data)
	}


    getLists();
	let price:any = []
    // 补发
    const userDelete = async (id: number) => {
     price = await feedback.prompt("请输入补发积分金额","补发积分");
	 console.log(price)
	 if(price.action=="confirm"){
		 reissue({log_id: id,reissue_price:price.value});
		 getLists()
	 }

    };

</script>
